import time
def metric(fn):
    def get_dotime(*args,**kw):
        start_time = time.time()
        fn(*args,**kw)
        end_time = time.time()
        print('耗时:{:.4f}s'.format(end_time-start_time))
    return get_dotime

#   测试代码：批改时直接将下方取消注释即可
# @metric
# def run():
#     time.sleep(2)
#     l = [x**2 for x in range(500)]
#     print('执行成功')
# run()
